[Feat] :: Added Docker Devcontainer#153
[Feat] :: Added Docker Devcontainer#153ryzen-xp wants to merge 1 commit intoSunsetLabs-Game:mainfrom ryzen-xp:feat_docker_devContainer
Conversation
WalkthroughAdds a development container configuration and a post-create bootstrap script. The dev container installs Rust and VS Code extensions, then runs a shell script that installs prerequisites, sets up asdf, and installs pinned versions of scarb, dojo, and starknet-foundry. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant VS as VS Code Dev Containers
participant DC as Devcontainer (Docker)
participant PC as postCreateCommand
participant SH as install-tools.sh
participant APT as apt-get
participant AS as asdf
participant PG as asdf plugins
VS->>DC: Build & start container (Debian + Rust feature)
DC-->>VS: Container ready (remoteUser=vscode)
VS->>PC: Run postCreateCommand
PC->>SH: bash .devcontainer/install-tools.sh
SH->>APT: Install curl, git, build-essential
SH->>AS: Install asdf v0.14.0 & source shell init
SH->>PG: asdf plugin-add scarb (tolerant)
SH->>PG: asdf plugin-add dojo (custom repo, tolerant)
SH->>PG: asdf plugin-add starknet-foundry
SH->>AS: asdf install/set-global pinned versions
SH-->>VS: ✅ Environment ready
note over SH,VS: Script uses set -e with tolerant plugin-add (|| true)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10–15 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (8)
.devcontainer/install-tools.sh (6)
2-2: Harden shell options.Enable undefined-var and pipefail for safer bootstraps.
-set -e +set -euo pipefail
10-13: Make asdf setup idempotent and address ShellCheck SC1090.Guard clone, avoid duplicate bashrc lines, and annotate the dynamic source for ShellCheck.
-git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0 -echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc -echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc -. ~/.asdf/asdf.sh +if [ -d "$HOME/.asdf" ]; then + git -C "$HOME/.asdf" fetch --tags && git -C "$HOME/.asdf" checkout "v0.14.0" +else + git clone https://github.com/asdf-vm/asdf.git "$HOME/.asdf" --branch v0.14.0 +fi +grep -qxF '. "$HOME/.asdf/asdf.sh"' "$HOME/.bashrc" || echo '. "$HOME/.asdf/asdf.sh"' >> "$HOME/.bashrc" +grep -qxF '. "$HOME/.asdf/completions/asdf.bash"' "$HOME/.bashrc" || echo '. "$HOME/.asdf/completions/asdf.bash"' >> "$HOME/.bashrc" +# shellcheck source=/home/vscode/.asdf/asdf.sh +. "$HOME/.asdf/asdf.sh"
16-26: Avoid masking plugin-add failures; make plugin management idempotent.Using
|| truecan hide real errors. Check for existing plugins and add/update accordingly.-asdf plugin add scarb || true +if ! asdf plugin list | grep -qx 'scarb'; then asdf plugin add scarb; fi asdf install scarb 2.10.1 asdf global scarb 2.10.1 -asdf plugin add dojo https://github.com/dojoengine/asdf-dojo || true +if ! asdf plugin list | grep -qx 'dojo'; then + asdf plugin add dojo https://github.com/dojoengine/asdf-dojo +fi asdf install dojo 1.5.0 asdf global dojo 1.5.0 -asdf plugin add starknet-foundry || true +if ! asdf plugin list | grep -qx 'starknet-foundry'; then asdf plugin add starknet-foundry; fi asdf install starknet-foundry 0.35.0 asdf global starknet-foundry 0.35.0
16-26: Optional: factor versions into variables for easier bumps.Minor QoL improvement for maintainability.
+# Versions +SCARB_VERSION=2.10.1 +DOJO_VERSION=1.5.0 +FOUNDRY_VERSION=0.35.0 -asdf install scarb 2.10.1 -asdf global scarb 2.10.1 +asdf install scarb "$SCARB_VERSION" +asdf global scarb "$SCARB_VERSION" - asdf install dojo 1.5.0 - asdf global dojo 1.5.0 +asdf install dojo "$DOJO_VERSION" +asdf global dojo "$DOJO_VERSION" - asdf install starknet-foundry 0.35.0 - asdf global starknet-foundry 0.35.0 +asdf install starknet-foundry "$FOUNDRY_VERSION" +asdf global starknet-foundry "$FOUNDRY_VERSION"
13-13: Silence ShellCheck SC1090 correctly.You already source a non-constant path; the directive above will prevent false positives. If you prefer not to pin the absolute path, you can disable the rule locally.
-. ~/.asdf/asdf.sh +# shellcheck disable=SC1090 +. "$HOME/.asdf/asdf.sh"
16-26: Consider addingasdf reshimafter installs.Some plugins don’t auto-reshim; adding explicit
asdf reshimavoids PATH surprises.asdf global starknet-foundry 0.35.0 + +asdf reshim.devcontainer.json (2)
3-3: Pin base image more tightly to reduce drift.Optional: switch to a specific Debian variant tag (e.g., bookworm) or digest to make environments reproducible.
-"image": "mcr.microsoft.com/devcontainers/base:debian", +"image": "mcr.microsoft.com/devcontainers/base:debian-bookworm",
13-17: Leverage features for common utilities instead of apt in script.You can avoid manual apt-get by adding common-utils (includes git, curl, sudo) and keep installs declarative.
"features": { + "ghcr.io/devcontainers/features/common-utils:2": {}, "ghcr.io/devcontainers/features/rust:1": { "version": "stable" } },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.devcontainer.json(1 hunks).devcontainer/install-tools.sh(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/install-tools.sh
[warning] 13-13: ShellCheck can't follow non-constant source. Use a directive to specify location.
(SC1090)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-and-test
🔇 Additional comments (2)
.devcontainer.json (2)
18-19: postCreateCommand runs as "vscode"; ensure bootstrap uses sudo.Given "remoteUser": "vscode", your install script must prefix apt-get with sudo (or move package installs to features). This ties to the fix suggested in install-tools.sh.
6-10: Extensions LGTM.Good coverage for Cairo/TOML/Rust.
Close #___
Summary by CodeRabbit